{% extends 'basic_app/master.html' %}
{% load my_filters %}
{% block tag_left %}
    {% include 'mytk_app/tag_left_user.html' %}
{% endblock %}
{% block title %}
    <title>ORATK</title>
{% endblock %}
{% block userinfo %}

    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <h2 class="page-header">功能点信息</h2>
        <form class="navbar-form navbar-left" role="search">
            {% include 'basic_app/search.html' %}
            <button type="button" class="btn btn-primary"
                    onclick="point_add()"><span
                    class="glyphicon glyphicon-plus" aria-hidden="true"></span> 添加功能点
            </button>
        </form>
        <table class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
                <th>名称</th>
                <th>描述</th>
                <th>sql文本</th>
                <th>SQLNAME</th>
                <th>是否有参数</th>
                <th>参数个数</th>
                <th>参数内容</th>
                <th>状态</th>
                <th>备注</th>
                <th>修改时间</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for i in current_page %}

                <tr>
                    <td style="display:none">{{ i.id }}</td>
                    <td>{{ i.name }}</td>
                    <td>{{ i.desc }}</td>
                    <td>
                        <a style="cursor:pointer" onclick="show_edit_sqltext({{ i.id }})"> 查看或修改sql文本</a>
                    </td>
                    <td>
                        <ul>
                            {% for part in  i.sqltext|to_list_filter %}
                                <li><a style="cursor:pointer"
                                       onclick="show_edit_sqltext_2('{{ i.id }}_{{ part.0 }}')">{{ part.0 }}</a></li>
                            {% endfor %}
                            <button type="button" class="btn btn-success btn-xs"
                                    onclick="add_sql({{ i.id }})"><span
                                    class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add_Sql
                            </button>

                        </ul>
                    </td>
                    <td>{{ i.args_mark | default_if_none:"" }}</td>
                    <td>{{ i.args_count | default_if_none:"" }}</td>
                    <td>{{ i.args_val | default_if_none:"" }}</td>
                    <td>
                        {% if i.status == 'locked' %}
                            <a style="cursor:pointer;color: red;"
                               onclick="change_point_status({{ i.id }},'{{ i.status }}')">{{ i.status }} </a>
                        {% else %}
                            <a style="cursor:pointer;color: green;"
                               onclick="change_point_status({{ i.id }},'{{ i.status }}')">{{ i.status }} </a>
                        {% endif %}
                    </td>

                    <td>{{ i.remark | default_if_none:"" }}</td>
                    <td>{{ i.chtime | date:'Y-m-d H:i:s' }}</td>
                    <td>{{ i.crtime | date:'Y-m-d H:i:s' }}</td>
                    <td><a onclick="point_edit({{ i.id }})">编辑</a> | <a
                            onclick="if(confirm('确认删除吗？')==false)return false;  else point_delete({{ i.id }})">删除</a>
                </tr>
            {% endfor %}
            </tbody>
        </table>
        {#        以上是分页#}
        {% include 'basic_app/paginator.html' %}
    </div>

    <!-- 模态框（Modal） 显示sql文本内容_全部-->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-dialog_edit">
            <div class="modal-content" style="width:1000px" id="docModalContent">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">SQLTEXT 内容</h4>
                </div>
                <div>&nbsp</div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary"
                                                            onclick="sqltext_modify()" id="bt_sqltext_modify"><span
                    class="glyphicon glyphicon-wrench"
                    aria-hidden="true"></span> 修改
            </button>
                <button type="button" class="btn btn-primary" onclick="script_content_edit_submit()" disabled
                        id="bt_sqltext_commit"><span
                        class="glyphicon glyphicon-ok"
                        aria-hidden="true"></span> 提交
                </button>
                <div>&nbsp</div>
                <div class="col-sm-12">
                            <textarea id="script_content_edit" style="width:960px;height:710px" type="text_area"
                                      name="script_content_edit" placeholder="SQLTEXT"
                                      disabled>{{ i.sqltext }}</textarea>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 模态框（Modal） 显示sql文本内容_单个-->
    <div class="modal fade" id="show_edit_sqltext_2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-dialog_edit">
            <div class="modal-content" style="width:1000px" id="docModalContent">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">SQLTEXT 详情</h4>
                </div>
                <div>&nbsp</div>
                &nbsp&nbsp&nbsp&nbsp
                <button type="button" class="btn btn-danger"
                        onclick=" if(confirm('确认删除吗？')==false)return false; else sqltext_del()" id="sqltext_del"><span
                        class="glyphicon glyphicon-wrench"
                        aria-hidden="true"></span> 删除
                </button>
                <button type="button" class="btn btn-primary"
                        onclick="sqltext_modify_2()" id="bt_sqltext_modify_2"><span
                        class="glyphicon glyphicon-wrench"
                        aria-hidden="true"></span> 修改
                </button>
                <button type="button" class="btn btn-primary" onclick="script_content_edit_submit_2()" disabled
                        id="bt_sqltext_commit_2"><span
                        class="glyphicon glyphicon-ok"
                        aria-hidden="true"></span> 提交
                </button>

                <div>&nbsp</div>
                <form class="form-horizontal" id="editForm">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">sql_name：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="sql_name_edit"
                                   placeholder="sql_name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">sql_desc：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="sql_desc_edit"
                                   placeholder="sql_desc">
                        </div>
                    </div>
                    <div>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <button id="copy" type="button" class="btn btn-primary" data-clipboard-target="#sql_text_edit">
                            Copy Sql
                        </button>
                    </div>
                    <div>&nbsp</div>
                    <div class="col-sm-12">
                            <textarea id="sql_text_edit" style="width:960px;height:710px" type="text_area"
                                      name="script_content_edit" placeholder="SQLTEXT"></textarea>
                    </div>
                </form>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 模态框（Modal） 添加功能点_全部-->
    <div class="modal fade" id="myModal_point_add_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-dialog_edit">
            <div class="modal-content" style="width:1000px" id="docModalContent">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">添加功能点</h4>
                </div>
                <div>&nbsp</div>
                <div>&nbsp</div>
                <form class="form-horizontal" id="editForm">
                    <div class="form-group" hidden>
                        <label class="col-sm-2 control-label">id：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="v_id"
                                   placeholder="id">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">name：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="add_name"
                                   placeholder="功能名称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">sqltext：</label>
                        <div class="col-sm-10">
                    <textarea type="text" style="width:330px;" class="form-control" id="add_sqltext"
                              placeholder="sqltext"></textarea> <span style="color:red"> &nbsp&nbsp&nbsp&nbsp&nbsp格式:  [('sqltext1','select 1 from dual'),('sqltext2','select 2 from dual')]</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">desc：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="add_desc"
                                   placeholder="描述">
                        </div>
                    </div>
                    <div class="form-group" id="limit_status_div">
                        <label class="col-sm-2 control-label">args_mark(是否有参数)：</label>
                        <div class="col-sm-3">
                            <select class="form-control" id="add_args_mark">
                                <option>否</option>
                                <option>是</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" id="limit_status_div">
                        <label class="col-sm-2 control-label">args_count：</label>
                        <div class="col-sm-3">
                            <select class="form-control" id="add_args_count">
                                <option>0</option>
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">args_val：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="add_args_val"
                                   placeholder="参数内容">
                            <span style="color:red">&nbsp&nbsp&nbsp&nbsp&nbsp提示:多个数值用";"分开</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">db_type：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="add_db_type" value="MYSQL"
                                   readonly>
                        </div>
                    </div>
                    <div class="form-group" id="status">
                        <label class="col-sm-2 control-label">status：</label>
                        <div class="col-sm-3">
                            <select class="form-control" id="add_status">
                                <option>active</option>
                                <option>locked</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">remake：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="add_remark"
                                   placeholder="备注">
                        </div>
                    </div>
                </form>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="point_commit()">提交</button>
                </div>

            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 模态框（Modal） 添加 sql_单个-->
    <div class="modal fade" id="myModal_add_sql" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-dialog_edit">
            <div class="modal-content" style="width:1000px" id="docModalContent">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">添加 SQL</h4>
                </div>
                <div>&nbsp</div>
                <div>&nbsp&nbsp&nbsp

                    <button type="button" class="btn btn-primary" onclick="add_sql_commit()"
                            id="add_sql_commit"><span
                            class="glyphicon glyphicon-ok"
                            aria-hidden="true"></span> 提交
                    </button>
                </div>
                <div>&nbsp</div>
                <form class="form-horizontal" id="editForm">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">sql_name：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="sql_name_commit"
                                   placeholder="sql_name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">sql_desc：</label>
                        <div class="col-sm-10">
                            <input type="text" style="width:300px;" class="form-control" id="sql_desc_commit"
                                   placeholder="sql_desc">
                        </div>
                    </div>
                    <div>&nbsp</div>
                    <div class="col-sm-12">
                            <textarea id="sql_text_commit" style="width:960px;height:710px" type="text_area"
                                      name="script_content_edit" placeholder="SQLTEXT"></textarea>
                    </div>
                </form>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

{% endblock %}

{% block script %}
    <script>
        //添加功能点
        function point_add() {
            //清空form下数据
            $("#editForm")[0].reset();
            //调用模态框
            $('#myModal_point_add_edit').modal('show')
        }

        //编辑功能点
        function point_edit(id) {
            var nid = id
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_point_info_ajax", //后台处理函数的url
                data: {
                    'nid': nid
                },
                cache: false,
                dataType: "json",
                success: function (result) {
                    $('#v_id').val(result.id);
                    $('#add_name').val(result.name);
                    $('#add_desc').val(result.desc);
                    $('#add_sqltext').val(result.sqltext);
                    $('#add_args_mark').val(result.args_mark);
                    $('#add_args_count').val(result.args_count);
                    $('#add_args_val').val(result.args_val);
                    //$('#add_exec_type').val(result.exec_type);
                    $('#add_status').val(result.status);
                    $('#add_remark').val(result.remark);
                    //调用模态框
                    $('#myModal_point_add_edit').modal('show')
                }
            })
        }

        //提交功能点
        function point_commit() {
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_add_point_ajax", //后台处理函数的url
                data: {
                    'id': $('#v_id').val(),
                    'add_name': $('#add_name').val(),
                    'add_desc': $('#add_desc').val(),
                    'add_sqltext': $('#add_sqltext').val(),
                    'add_args_mark': $('#add_args_mark').val(),
                    'add_args_count': $('#add_args_count').val(),
                    'add_args_val': $('#add_args_val').val(),
                    'add_db_type': $('#add_db_type').val(),
                    {#'add_args_val_exec_type': $('#add_exec_type').val(),#}
                    'add_status': $('#add_status').val(),
                    'add_remark': $('#add_remark').val()
                },
                cache: false,
                dataType: "html",
                beforeSend: function () {
                    showLoading()
                },
                complete: function () {
                    hideLoading()
                },
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })
        }


        //删除功能点
        function point_delete(id) {
            var action_mark = 'delete'
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_delete_lock_ajax", //后台处理函数的url
                data: {
                    'id': id,
                    'action_mark': action_mark
                },
                cache: false,
                dataType: "html",
                beforeSend: function () {
                    showLoading()
                },
                complete: function () {
                    hideLoading()
                },
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })
        }

        //锁定功能点
        function point_lock(id) {
            var action_mark = 'lock'
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_delete_lock_ajax", //后台处理函数的url
                data: {
                    'id': id,
                    'action_mark': action_mark
                },
                cache: false,
                dataType: "html",
                beforeSend: function () {
                    showLoading()
                },
                complete: function () {
                    hideLoading()
                },
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })
        }

        //锁定或激活point
        function change_point_status(id, status) {
            if (status == 'locked') {
                var message = "是否激活该point";
            }
            if (status == 'active') {
                var message = "是否锁定该point";
            }
            var iconType = "info";
            var title = "更改point状态";
            var message = message;
            let iscancelButton = false;
            showAlert(title, message, iconType, iscancelButton, function () {
                $.ajax({
                    type: "POST",
                    url: "/oratk_app/oratk_tool_info_ora_delete_lock_ajax", //后台处理函数的url
                    data: {
                        'id': id,
                        'action_mark': status
                    },
                    cache: false,
                    dataType: "html",
                    beforeSend: function () {
                        showLoading()
                    },
                    complete: function () {
                        hideLoading()
                    },
                    success: function (result) {
                        if (result == 'SUCCESS') {
                            location.reload()
                        } else {
                            alert(result)
                        }
                    }
                })
            });
        }


        //展示sqltext_old
        function show_edit_sqltext(id) {
            var nid = id
            $('#myModal').attr('nid', nid)
            $("#script_content_edit").prop('disabled', true);
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_getSqltext_ajax", //后台处理函数的url
                data: {
                    'nid': nid
                },
                cache: false,
                dataType: "html",
                success: function (result) {
                    $("#script_content_edit").val(result);
                    //调用模态框
                    $('#myModal').modal('show')
                }
            })
        }

        //展示sqltext_new
        function show_edit_sqltext_2(id) {
            var nid = id
            $('#show_edit_sqltext_2').attr('nid', nid)
            $("#sql_text_edit").prop('readonly', true);
            $("#sql_desc_edit").prop('readonly', true);
            $("#sql_name_edit").prop('readonly', true);
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_getSqltext_ajax_2", //后台处理函数的url
                data: {
                    'nid': nid
                },
                cache: false,
                dataType: "html",
                success: function (result) {
                    result_f = JSON.parse(result)
                    console.log(typeof result_f)
                    console.log(2)
                    console.log(result)
                    $("#sql_name_edit").val(result_f['sql_name']);
                    $("#sql_text_edit").val(result_f['sql_text']);
                    $("#sql_desc_edit").val(result_f['sql_desc']);
                    //调用模态框
                    $("#copy").prop('disabled', false);
                    $("#copy").text('Copy Sql')
                    $('#show_edit_sqltext_2').modal('show')
                }
            })
        }

        //展示add_sql
        function add_sql(id) {
            var nid = id;
            $('#myModal_add_sql').modal('show')
            $('#myModal_add_sql').attr('nid', nid)
        }

        //提交add_sql
        function add_sql_commit() {
            var sql_name_commit = $('#sql_name_commit').val();
            var sql_text_commit = $('#sql_text_commit').val();
            var sql_desc_commit = $('#sql_desc_commit').val();
            var nid = $('#myModal_add_sql').attr('nid');
            if (sql_name_commit == '') {
                alert('sql_name 不能为空');
                return;
            }
            if (sql_text_commit == '') {
                alert('sqltext 不能为空');
                return;
            }

            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_SqltextModify_ajax_2", //后台处理函数的url
                data: {
                    'modify_type': 'NEW',
                    'nid': nid,
                    'sql_name': sql_name_commit,
                    'sql_desc': sql_desc_commit,
                    'sql_text': sql_text_commit
                },
                cache: false,
                dataType: "html",
                {#beforeSend: function () {#}
                {#    showLoading()},#}
                {#complete: function () {#}
                {#    hideLoading()},#}
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })


        }

        // 删除 单个sql
        function sqltext_del() {
            nid = $('#show_edit_sqltext_2').attr('nid');
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_SqltextModify_ajax_2", //后台处理函数的url
                data: {
                    'modify_type': 'DELETE',
                    'nid': nid
                },
                cache: false,
                dataType: "html",
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })

        }

        //sqltext变更为可编辑状态
        function sqltext_modify() {
            $("#bt_sqltext_modify").prop('disabled', true);
            $("#script_content_edit").removeAttr("disabled");
            $("#bt_sqltext_commit").removeAttr("disabled");
        }

        //提交sqltext
        function script_content_edit_submit(id) {
            var sqltext_content = $('#script_content_edit').val()
            nid = $('#myModal').attr('nid')
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_SqltextModify_ajax", //后台处理函数的url
                data: {
                    'nid': nid,
                    'sqltext_content': sqltext_content
                },
                cache: false,
                dataType: "html",
                beforeSend: function () {
                    showLoading()
                },
                complete: function () {
                    hideLoading()
                },
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })
        }


        //sqltext_2变更为可编辑状态
        function sqltext_modify_2() {
            $("#sql_name_edit").removeAttr("readonly");
            $("#sql_desc_edit").removeAttr("readonly");
            $("#sql_text_edit").removeAttr("readonly");
            $("#bt_sqltext_commit_2").removeAttr("disabled");
        }

        //提交sqltext_2
        function script_content_edit_submit_2(id) {
            var sql_name_edit = $('#sql_name_edit').val();
            var sql_desc_edit = $('#sql_desc_edit').val();
            var sql_text_edit = $('#sql_text_edit').val()
            nid = $('#show_edit_sqltext_2').attr('nid')
            $.ajax({
                type: "POST",
                url: "/oratk_app/oratk_tool_info_ora_SqltextModify_ajax_2", //后台处理函数的url
                data: {
                    'modify_type': 'EDIT',
                    'nid': nid,
                    'sql_name': sql_name_edit,
                    'sql_desc': sql_desc_edit,
                    'sql_text': sql_text_edit
                },
                cache: false,
                dataType: "html",
                beforeSend: function () {
                    showLoading()
                },
                complete: function () {
                    hideLoading()
                },
                success: function (result) {
                    if (result == 'SUCCESS') {
                        location.reload()
                    } else {
                        alert(result)
                    }
                }
            })
        }

        //模态框居中
        $("#myModal_point_add_edit").on('show.bs.modal', function () {
            modalResize_add_edit();
        })
        $("#myModal_add_sql").on('show.bs.modal', function () {
            modalResize_add_edit();
        })
        $("#show_edit_sqltext_2").on('show.bs.modal', function () {
            modalResize_add_edit();
        })
        $(window).resize(function () {
            modalResize_add_edit();
        })

        function modalResize_add_edit() {
            var winWidth = $(document.body).width();
            var modalWidth = $("#docModalContent").width();
            var width = (winWidth - modalWidth) / 2 + "px"
            console.log(winWidth, modalWidth, width)
            $("#myModal_point_add_edit").find(".modal-dialog").css({
                'margin-left': width
            });
            $("#show_edit_sqltext_2").find(".modal-dialog").css({
                'margin-left': width
            });
            $("#myModal_add_sql").find(".modal-dialog").css({
                'margin-left': width
            });
        }

        var clipboard = new ClipboardJS('#copy');
        clipboard.on('success', function (e) {
            console.log(e);
            console.log("复制成功！");
            {#$("#sql_text_edit").prop('reanonly', true);#}
            window.getSelection().empty()
            $("#copy").text('Copied')
            $("#copy").prop('disabled', true);
            setTimeout(set_copy_button, 3000);

        });

        function set_copy_button() {
            $("#copy").text('Copy Sql')
            $("#copy").prop('disabled', false);
            {#window.getSelection().removeAllRanges();#}
            console.log("按钮重置！");
        }

        clipboard.on('error', function (e) {
            console.log(e);
            alert("复制失败！");
        });
    </script>
{% endblock %}